package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsNidType1Vw;
import com.auxgroup.hr.front.dao.repository.PsNidType1VwRepository;
import com.auxgroup.hr.front.service.personnal.NidType1VwService;

/** 
 * @author wangchangyun
 * @version 创建时间：180527 
 * 社保公积金service
 */
@Service("nidType1VwService")
public class NidType1VwServiceImpl implements NidType1VwService {
	
	@Autowired
	private PsNidType1VwRepository PsNidType1VwRepository;


	@Override
	@Cacheable(value="NATIONAL_VALUE",key="#nationalIdType")
	public PsNidType1Vw getNidType1Vw(String nationalIdType) {
		PsNidType1Vw NidType1Vw = new PsNidType1Vw();
		NidType1Vw.setCountry("CHN");
		NidType1Vw.setNationalIdType(nationalIdType);
		List<PsNidType1Vw> nidTypes = PsNidType1VwRepository.findAll(Example.of(NidType1Vw));
		if(!nidTypes.isEmpty()){
			return nidTypes.get(0);
		}
		return null;
	}
	
	
	@Override
	@Cacheable(value="NATIONAL_LIST")
	public List<PsNidType1Vw> getAll() {
		PsNidType1Vw NidType1Vw = new PsNidType1Vw();
		NidType1Vw.setCountry("CHN");
		return PsNidType1VwRepository.findAll(Example.of(NidType1Vw));
	}


	
	
	
}
